/*
 *    Copyright (c) 2018-2025, lengleng All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the pig4cloud.com developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: lengleng (wangiegie@gmail.com)
 */

package com.pig4cloud.pigx.user.entity;


import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.time.LocalDateTime;

/**
 * 用户apiKey
 *
 * @since 2022-10-28 15:47:24
 */
@Data
@TableName("ripple_user_api_key")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "用户apiKey")
public class UserApiKey extends Model<UserApiKey> {

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @TableId(type = IdType.ASSIGN_ID)
    @ApiModelProperty(value = "主键")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;

    /**
     * 用户id
     */
    @ApiModelProperty(value = "用户id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long userId;

    /**
     * 名称
     */
    @ApiModelProperty(value = "名称")
    private String name;

    /**
     * 访问密钥
     */
    @ApiModelProperty(value = "访问密钥")
    private String accessKey;

    /**
     * 保密密钥，默认不能查询出来
     */
    @ApiModelProperty(value = "保密密钥")
    @TableField(select = false)
    private String secretKey;

    /**
     * 权限，以空格作为间隔
     */
    @ApiModelProperty(value = "权限，以空格作为间隔")
    private String permission;

    /**
     * 是否限制ip（0否、1是）
     */
    @ApiModelProperty(value = "是否限制ip（0否、1是）")
    private String hasIpLimit;

    /**
     * ip数量
     */
    @ApiModelProperty(value = "ip数量")
    private Integer ipNum;

    /**
     * 最近导致封禁的封禁id（与ripple_user_api_key_lock_detail.id对应）
     */
    @ApiModelProperty(value = "最近导致封禁的封禁id（与ripple_user_api_key_lock_detail.id对应）")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long lockId;

    /**
     * 封禁次数
     */
    @ApiModelProperty(value = "封禁次数")
    private Integer lockCount;

    /**
     * 解封次数
     */
    @ApiModelProperty(value = "解封次数")
    private Integer unlockCount;

    /**
     * 创建时间
     */
    @ApiModelProperty(value = "创建时间")
    private LocalDateTime createTime;

    /**
     * 创建人
     */
    @ApiModelProperty(value = "创建人")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long createBy;

    /**
     * 创建时间
     */
    @ApiModelProperty(value = "创建时间")
    private LocalDateTime updateTime;

    /**
     * 修改人
     */
    @ApiModelProperty(value = "修改人")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long updateBy;

    /**
     * 状态（0正常、1封禁）
     */
    @ApiModelProperty(value = "状态（0正常、1封禁）")
    private String status;

    /**
     * 是否删除（0否、null是）
     */
    @ApiModelProperty(value = "是否删除（0否、null是）")
    private String isDeleted;

}
